import {LogLanguage} from "../dist/index.js"

// 测试只包含字符串的输入
const testCase = '"test string"'

console.log("Testing string-only input...")
console.log(`Input: ${testCase}`)

try {
  const tree = LogLanguage.parser.parse(testCase)
  console.log("✅ Parse successful!")
  
  // 检查所有节点
  console.log("\nAll nodes:")
  tree.iterate({
    enter: (node) => {
      const text = testCase.slice(node.from, node.to)
      console.log(`- ${node.name}: "${text}" (${node.from}-${node.to})`)
    }
  })
  
  // 特别检查字符串节点
  console.log("\nLooking for String nodes:")
  let foundString = false
  tree.iterate({
    enter: (node) => {
      if (node.name === "String") {
        foundString = true
        const text = testCase.slice(node.from, node.to)
        console.log(`Found String: "${text}"`)
      }
      if (node.name === "StringExpression") {
        foundString = true
        const text = testCase.slice(node.from, node.to)
        console.log(`Found StringExpression: "${text}"`)
      }
    }
  })
  
  if (!foundString) {
    console.log("❌ No string nodes found")
  }
  
} catch (error) {
  console.log(`❌ Parse failed: ${error.message}`)
} 